﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;
/// <summary>
/// TFile 的摘要说明
/// </summary>
public class TFile:TData
{

    	//常量
  	const string CTableName="t_file";
    const string CKeyName = "id";
    //与数据表字段对应的变量
    private string FId ; 
    private int FIId ; 
    private string FName ; 
    private int FSize ; 
    private string FKeyWord ; 
    private string FRemark ;
    private string FPath;
    private int FStatus ; 
    private decimal FSortNum ; 
    private string FInMan ; 
    private DateTime FInTime ;
    private DateTime FDate;
	public TFile()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
        FTableName = CTableName;
        FKeyName = CKeyName;

	}
    public TFile(string sid)
    {
    	FTableName = CTableName;
        FKeyName = CKeyName;
        FKeyValue = sid;
    }
    public override void Select()
    {
        string strSql = GetSelectString();
        TSqlDB oDB = new TSqlDB(strSql);
        if (!oDB.EOF)
        {

            FId = oDB["Id"].ToString();
            FIId = oDB["IId"].ToInt();
            FName = oDB["Name"].ToString();
            FSize = oDB["Size"].ToInt();
            FKeyWord = oDB["KeyWord"].ToString();
            FRemark = oDB["Remark"].ToString();
            FPath = oDB["Path"].ToString();
            FDate = oDB["Date"].ToDateTime();
            FStatus = oDB["Status"].ToInt();
            FSortNum = oDB["SortNum"].ToDecimal();
            FInMan = oDB["InMan"].ToString();
            FInTime = oDB["InTime"].ToDateTime();

        }
        oDB.Free();
    }
    //插入新记录。
    public void Insert()
    {
        string ExSql ="'" +  FId +  "','" + FName + "','" + FSize + "','" + FKeyWord + "','" + FRemark + "','" + FPath + "','" + FDate + "','" + FStatus + "','" + FSortNum + "','" + FInMan + "','" + FInTime + "'" ;
        base.Insert(ExSql);
    }
    //更新记录。
    public void Update()
    {
        string ExSql = " Name ='" + FName + "', Size ='" + FSize + "', KeyWord ='" + FKeyWord + "', Remark ='" + FRemark + "', Path='" + FPath  + "', Date='" + FDate + "', Status ='" + FStatus + "', SortNum ='" + FSortNum + "', InMan ='" + FInMan + "', InTime ='" + FInTime + "'"; 
        base.Update(ExSql);
    }
    //改变状态,0=未验证,1=已通过验证
    public void Update_status()
    {
        string ExSql = "status=" + FStatus.ToString(); ;
        base.Update(ExSql);
    }
    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string sID)
    {
        TData.DeleteByID(sID, CTableName, CKeyName);
    }


    public string Id
    {
        get
        {
            return FId;
        }
        set
        {
            FId = value;
        }
    }
    public int IId
    {
        get
        {
            return FIId;
        }
        set
        {
            FIId = value;
        }
    }
    public string Name
    {
        get
        {
            return FName;
        }
        set
        {
            FName = value;
        }
    }
    public int Size
    {
        get
        {
            return FSize;
        }
        set
        {
            FSize = value;
        }
    }
    public string KeyWord
    {
        get
        {
            return FKeyWord;
        }
        set
        {
            FKeyWord = value;
        }
    }
    public string Remark
    {
        get
        {
            return FRemark;
        }
        set
        {
            FRemark = value;
        }
    }
    public string Path
    {
        get
        {
            return FPath;
        }
        set
        {
            FPath = value;
        }
    }
    public DateTime Date
    {
        get
        {
            return FDate;
        }
        set
        {
            FDate = value;
        }
    }
    public int Status
    {
        get
        {
            return FStatus;
        }
        set
        {
            FStatus = value;
        }
    }
    public decimal SortNum
    {
        get
        {
            return FSortNum;
        }
        set
        {
            FSortNum = value;
        }
    }
    public string InMan
    {
        get
        {
            return FInMan;
        }
        set
        {
            FInMan = value;
        }
    }
    public DateTime InTime
    {
        get
        {
            return FInTime;
        }
        set
        {
            FInTime = value;
        }
    }
}
